  Ideological Scaling of Social Media Users: A Dynamic Lexicon Approach (DLA)
===============================================================================
                             REPLICATION MATERIALS

Notice
------
This archive contains the replication materials for Temporão, Mickael, Corentin
Vande Kerckhove, Clifton van der Linden, Yannick Dufresne, and Julien M.
Hendrickx. 2017. "Replication Data for: Ideological Scaling of Social Media
Users. A Dynamic Lexicon Approach", doi:10.7910/DVN/0ZCBTB, Harvard Dataverse,
Version XXXX.

In compliance with Twitter's Developer Policy, the data provided contain only
the publicly available Twitter IDs for the political candidates used to
generate a dictionary file in each electoral context. All personal information
collected by Vox Pop Labs via Vote Compass has been anonymized in accordance
with the provisions of the Vox Pop Labs privacy policy.

The data provided in the replication materials consists of a random sample
of 5000 users from the original dataset for each election.
The results obtained when using the replication materials may vary slightly
from those presented in the article.

The axis on some figures have been flipped to reflect a more intuitive
left-right ideological dimension. We associate positive values to
right-wing/conservative parties and, conversely, negative values with
left-wing/liberal parties.

When replicating the code, the output labels from the textual scaling methods
map to the ones reported in the paper as following:

Dynamic lexicon    = textual_new
Wordfish-all       = textual_baseline
Wordfish-political = textual_weighted
Network            = network

If you have any questions or problems with these replication materials, please
feel free to contact the corresponding author.


Contact info
------------
Mickael Temporão [*]     - Université Laval
Corentin Vande Kerckhove - Université Catholique de Louvain
Clifton van der Linden   - University of Toronto
Yannick Dufresne         - Université Laval
Julien M. Hendrickx      - Université Catholique de Louvain
____________
[*] Corresponding author mickael.temporao.1@ulaval.ca
December 12, 2017


Requirements
------------
Please install the following requirements before getting started:
- R 3.4 (https://www.r-project.org/)
- Python 2.7 or 3.6 (https://www.python.org/)
- Pip (https://pip.pypa.io/)
- Pipenv (https://github.com/pypa/pipenv)


Getting Started
---------------
The following commands take around 24 hours to run.
The code was tested on macOS 10.13.3 (2.7GHz dual-core Intel Core i5 processor)

0. Install all the requirements listed in the requirements sections.

1. Extract the contents of the compressed archive "dla_archive.zip".

2. Open your terminal and set the working directory to the "code" folder.
    cd path/dla_archive/code

3. Run the following commands in the terminal:
    pipenv --two
    pipenv install
    pipenv shell
    pipenv install matplotlib

4. Launch the code scripts in the terminal by running the following commands:
    Rscript 0_packages.R
    python 1_network_matrix.py
    Rscript 2_network_ideologies.R
    Rscript 3_textual_ideologies.R
    Rscript 4_appendix_filters.R
    python 5_aggregate_features.py
    python 6_learn_features.py
    python 7_generate_figures.py


Final Notes
-----------
The scripts output can be found in:
    data/output/
